#pragma once

#include <iostream>
#include <random>
#include <ctime>

#include <opencv2/opencv.hpp>

class WaterFilling
{
	int numberOfDrops;
	float threshold;
	float waterInADrop;
	float waterDropped;
	int iterationNumber;
	float scale;
	float factor;

	int step;



	std::map<std::pair<int, int>, float> measureFunction;

	void GetMeasureFunction(cv::Mat & depthImage);
	float ComputeMaximum();
	void Thresholding(cv::Mat & depthImage);
	std::vector<std::vector<cv::Point>> ContourAnalisys(cv::Mat & thresholdedImage);

public:
	float allTime;
	float minTime;
	float maxTime;

	WaterFilling(int nod = 1, float wid = 1.f, float wd = 1.f, int in = 10, float thr = 40.f) : numberOfDrops(nod),
		waterInADrop(wid), waterDropped(wd), iterationNumber(in), threshold(thr) 
	{
		allTime = 0.f; minTime = FLT_MAX; maxTime = 0.f;
	}

	cv::Mat ApplyWaterFilling(cv::Mat & depthImage);
	cv::Mat ApplyFastWaterFilling(cv::Mat & depthImage);
};